package advanced.practice._1001;

import java.util.Scanner;

public class Main {
    public static void main(String...args){
        Scanner scanner=new Scanner(System.in);

        int N=scanner.nextInt();
        RationalNumber[] rationalNumbers=new RationalNumber[N];

        for(int i=0;i<N;i++){
            String item=scanner.next().trim();
            if(item.contains("/")){
                int sep=item.indexOf("/");
                int son=Integer.parseInt(item.substring(0,sep));
                int mother=Integer.parseInt(item.substring(sep+1));
                rationalNumbers[i]=new RationalNumber(son,mother);
            }else{
                rationalNumbers[i]=new RationalNumber(Integer.parseInt(item),1);
            }
        }

        RationalNumber summer=new RationalNumber(0,1);
        for(RationalNumber number:rationalNumbers){
            summer.add(number);

        }

        System.out.println(summer.toSimpleFormString());
    }

    static class RationalNumber{
        long integer;
        long numerator;
        long denominator;

        RationalNumber(long son,long mother){
            if(mother<0){
                numerator=-son;
                denominator=-mother;
            }else{
                numerator=son;
                denominator=mother;
            }
            toSimpleForm();
//            System.out.println(toSimpleFormString());
        }

        private void toSimpleForm(){

            integer+=numerator/denominator;
            numerator=numerator%denominator;

            if(numerator<0){
                integer--;
                numerator=denominator+numerator;
            }
        }

        private void add(RationalNumber other){
            integer+=other.integer;

            if(denominator%other.denominator==0){
                numerator+=other.numerator*(denominator/other.denominator);
            }else if(other.denominator%denominator==0){
                numerator=numerator*(other.denominator/denominator)+other.numerator;
                denominator=other.denominator;
            } else{
                numerator=numerator*other.denominator+denominator*other.numerator;
                denominator=denominator*other.denominator;
            }

            toSimpleForm();
        }

        private void simplify(){
            if(numerator==0){
                denominator=1;
                return;
            }
            long common=getCommon(numerator,denominator);
            numerator/=common;
            denominator/=common;
        }

        private long getCommon(long a,long b){
            if(a<b){
                return getCommon(b,a);
            }
            if(a%b==0){
                return b;
            }

            return getCommon(b,a%b);
        }


        private void deSimple(){
            if(integer<0&&numerator!=0){
                integer++;
                numerator=numerator-denominator;
            }
        }
        private String toSimpleFormString(){
            simplify();
            deSimple();
            if(numerator==0){
                return ""+integer;
            }else if(integer==0){
                return ""+numerator+"/"+denominator;
            }
            return ""+integer+" "+numerator+"/"+denominator;
        }
    }
}
